package com.example.demo.mapper;

import com.example.demo.entity.Reservation;
import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select u_id, username, password, admin from users where username=#{username} and password=#{password}")
    User findUserID(User user);

    @Select("select username, password, admin from users where username=#{username}")
    User findAUsers(String username);

    @Insert("insert into users(username,password) values (#{username}, #{password})")
    int addUser(Reservation reservation);

    @Update("update users set password = #{pwd} where username = #{username}")
    int changePWD(String username, String pwd);

}
